home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
DEV
/
I-Z
/
MEdit_1.5.cpt
/
C.mcr
< prev
next >
Wrap
Text File
|
1986-04-18
|
4KB
|
250 lines
* 'C' Macros file for Medit 1.3
* Frank Alviani
* 5:11:30 PM 4/15/86
*
* for use together with the following macros
* 1
"Save current Position/P" {
push;
};
* 2
* jumps back to the last saved position with macro 1
* the stack can hold the last eight positions
"Back to Position/B" {
select(L[,C[)!;
pop;
};
* 3
* Inserts blanks until current column lined up with position on stack
"Line up/L" {
while NOT C: > C[ {
Insert (" ");
};
};
*
* select from stacked position to here, clean up stack
"Select to here/H" {
select (L],C] | L:,C:);
drop;
};
"-" {};
* 5
* puts an "if" statement at the current location
"If/I" {
push;
Insert("if ()\t/* */\n");
call(3);
Insert(" { \n}");
pop;
Select(L.,C.+4);
};
* 6
* puts an "if else" statement at the current location
"If else/E" {
push;
Insert("if ()\t/* */\n");
call (3);
Insert(" { \n}\n}");
* on "else line", line up with "if"
Select(L.,C$-3|L.,C$);
Cut;
Insert("else\t/* */\n { \n}");
Select(L$-6,C.+4);
drop;
};
* 7
* puts a "while" statement at the current location
"While/W" {
push;
Insert ("while ()\t/* */\n");
call (3);
Insert(" { \n}");
pop;
Select(L.,C.+7);
};
*
* puts a "do" statement at the current location
"Do/Q" {
Insert ("do");
push;
Insert (" {\n");
call (3);
Insert ("} while ();");
drop;
select (L.,C$-2);
};
* 8
* puts a "for" statement at the current location
"For/R" {
push;
Insert ("for (;;)\t/* */\n");
call (3);
Insert (" { \n}");
pop;
Select(L.,C.+5);
};
* 9
* puts a switch" statement at the current location
"Switch/S" {
push;
Insert ("switch ()\n");
call (3);
Insert (" { \n}");
drop;
select (L.-2, C$-1);
};
* 10
* puts a "case" phrase at the current location
"Case/A" {
push;
Insert ("case :\n");
call (3);
Insert (" break;");
drop;
select (L.-1,C$-1);
};
*
* comments out current line with //
"Comment out line//" {
select (L., 0);
Insert ("// ");
};
"-" {};
* 12
* jump to bottom of file
"Bottom" {
SELECT(L$,C$)!;
};
* 13
* jump to top of file
"Top" {
SELECT(0,0)!;
};
* 14
* ask for a line number to jump to and do it
"Jump to Line/J" {
prompt("Goto Line",#0);
select(#0-1,0|#0-1,C$)!;
};
* 15
* replace the shortcut to the left of the cursor position with
* the appropriate string. to define shortcuts write them at the
* top of the window followed by the string to insert. use one line for
* each shortcut. separate string and shortcut by a blank.
* examples: (define them without an asterik at the start of the window)
* ilm I like Macintosh
* gb Good bye
*
* if you type 'ilm' and then press command-g this will replace
* 'ilm' with 'I like Macintosh'. 'gb' will be replaced by 'Good bye'
"Glossary/G" {
Select(L.,C<|L.,C.);
Push;
Set($0,$S);
Select(0,0);
Find($0);
If L. < L[ And C. = 0{
Select(L.,C:+1|L.,C$);
Copy;
Pop;
Paste;
}
Else {
Pop;
Select(L:,C:);
};
};
* 16
* scroll one screen down
* if you have a Mac+ or a numeric keypad you may use shift-cursor-down
"Page Down/D" 272 {
* get screen height
Set(#9, L>-L<-1);
Select(L>+#9,C.)!;
};
* 17
* scroll one screen up
* if you have a Mac+ or a numeric keypad you may use shift-cursor-up
"Page Up/U" 277 {
* get screen height
Set(#9, L>-L<-1);
Select(L<-#9,C.)!;
};
* 18
* replace all 'real' tabs by blank strings
* this is useful to convert 'Edit'- to 'MEdit'-files
"Replace tabs" {
SELECT(0,0)!;
FIND("\9");
WHILE NOT L. = 0 OR NOT C. = 0 {
INSERT("\t");
FIND("\9");
};
};
*19
* redefines shift-BS to 'delete to end of line'
* instead of 'delete right char'
251 {
Select(L.,C.|L.,C$);
Clear;
};
* 20
* this macro moves to the END of the next line (option-return)
336 {
select (L.+1,C$)!;
};
* the numbers define cursor keys on a Mac Plus / num Keypad
* up
177 {
SELECT(L.-1,C.)!;
};
* down
172 {
SELECT(L.+1,C.)!;
};
* right
166 {
SELECT(L.,C.+1)!;
IF C. = C$ {
SELECT(L.+1,0)!;
};
};
* left
170 {
SELECT(L.,C.-1)!;
IF C. = 0 {
SELECT(L.-1,0);
SELECT(L.,C$);
};
}.